package ru.tapublog.lib.samsungwallet.api.model;

public class Barcode extends AbstractViewElement{

	private String caption;
	private BARCODE_TYPE type;
	private String value;

	public Barcode(String id, String value, BARCODE_TYPE barcodeType) {
		this(id,null, value, barcodeType);
	}

	public Barcode(String id, String caption, String value, BARCODE_TYPE barcodeType) {
		setId(id);
		setCaption(caption);
		this.type = barcodeType;
		setValue(value);
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getCaption() {
		return caption;
	}

	public void setCaption(String caption) {
		if (caption != null && caption.length() > 25)
			throw new IllegalArgumentException(
					"Barcode caption cannot be more than 25 symbols");
		this.caption = caption;
	}

	public BARCODE_TYPE getBarcodeType() {
		return type;
	}

	public void setBarcodeType(BARCODE_TYPE barcodeType) {
		this.type = barcodeType;
	}

}
